package durst.data;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
import com.sdicons.json.mapper.JSONMapper;

import durst.data.dao.impl.FriendDao;
import durst.data.json.FriendJSONHelper;

@DatabaseTable(tableName = "Friend", daoClass = FriendDao.class)
public class Friend extends CSDEntity {
	public static final String ACCOUNT_ID = "account_id";
	public static final String TARGET_ID = "target_id";

	static {
		JSONMapper.addHelper(new FriendJSONHelper());
	}
	
	@DatabaseField(generatedId = true) 
	private int id; 
	
	@DatabaseField(canBeNull = false, foreign = true, columnName = ACCOUNT_ID) 
	private Account account; 
	
	@DatabaseField(canBeNull = false, foreign = true, columnName = TARGET_ID)
	private Account target; 
	
	public Friend() {}
	
	public Friend(Account account, Account target) {
		this.account = account;
		this.target = target;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Account getAccount() {
		return account;
	}

	public void setAccount(Account account) {
		this.account = account;
	}

	public Account getTarget() {
		return target;
	}

	public void setTarget(Account target) {
		this.target = target;
	}
}
